package com.yanqu.road.server.cmd.chefduel.process2.auto;

import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.chefduel.ChefDuelProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.chefduel.CrossChefDuelMgr;
import com.yanqu.road.server.manager.user.CrossUserMgr;
import com.yanqu.road.server.protocol.Protocol;

/**
 * @Author : Cxp
 * @Time : 2024-12-17
 * @Description : 获取摊主可试吃数量
 */

@Cmd(code = Protocol.C_CROSS_CHEF_DUEL2_GET_TASTE_TABLE_CNT, desc = "获取摊主可试吃数量")
public class CrossChefDuel2GetTasteTableCntCmd extends CrossCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ChefDuelProto.CrossChefDuel2GetTasteTableCntMsg reqMsg = ChefDuelProto.CrossChefDuel2GetTasteTableCntMsg.parseFrom(packet.getBytes());

        ChefDuelProto.CrossChefDuel2AutoJoinInfoMsg autoJoinInfo = reqMsg.getAutoJoinInfo();
        int activityId = autoJoinInfo.getHostActivityId();
        CrossChefDuelMgr.getTasteTableCnt(serverId, activityId, reqMsg);
        if(reqMsg.hasUserBaseInfo()){
            CrossUserMgr.updateUserBaseInfo(packet.getPlayerId(), PlayerBasePb.parseBaseUserInfo(reqMsg.getUserBaseInfo()));
        }
    }

    @Override
    public void sendData() {
    }
}